<?php
class Subscribe_Push_Main
{
	public static function main()
	{
		while (true) {
			$weekday = date('w', strtotime(date('Y-m-d')));
			if (date('H:i:s') <= '15:00:00' && date('H:i:s') >= '09:25:00' 
			&& $weekday != 0 && $weekday != 6) {
				self::atom();
			} else {
				//用于停掉观察者的死循环
				break;
			}
		}
	}
	
	public static function atom()
	{
		$one = new Subscribe_Push_Subject_Main();
		$observer = new Subscribe_Push_Observer($one);
		$one->dealTrigger();
	}
	
	public static function test($currPrice, $code)
	{
		$weekday = date('w', strtotime(date('Y-m-d')));
		if (date('H:i:s') <= '15:00:00' && date('H:i:s') >= '09:25:00' 
		&& $weekday != 0 && $weekday != 6) {
			$one = new Subscribe_Push_Subject_Main();
			$observer = new Subscribe_Push_Observer($one);
			$one->test($currPrice, $code);
		}
	}
}